<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	  <head>
	    <base href="<%=basePath%>">
	    <title>add_room.jsp</title>
	    
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">    
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		
		<link rel="stylesheet" type="text/css" href="./css/style.css">
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<SCRIPT type="text/javascript">
		var flag=true;
		function change(){
		
		 var type=$("#type" ).val();
		 if(type==3){
		 
		 	//var obj = $("#add");
		 	var obj = document.getElementById("add");
		 	obj.style.display="block";
		 }else{
		 	//var obj = $("#add");
		 	var obj = document.getElementById("add");
		 	obj.style.display="none";
		 	var op1 = document.getElementById("op1");
		 	op1.selected="selected";
		 
		 }
		 if(type==5||type==4){
		 	var obj = document.getElementById("del");
		 	obj.style.display="none";
		 
		 }else{
		 	var obj = document.getElementById("del");
		 	obj.style.display="block";
		 	var op1 = document.getElementById("op1");
		 	op1.selected="selected";
		 
		 }
		
		}
		function check(){
			var name= $("#name").val();
			if(name.length>0&&name.length<=10){
			 $("#message").html("");
			 flag=true;
			}else{
				$("#message").html(" * 角色名为空或过长（最多10位）");
				flag=false;
			}
		
		}
		function sub(){
		
			if(flag){
			return true;
			}
			else{
			return false;
			}
		
		}
		
		
		
		</SCRIPT>
		
	  </head>
	  
	  <body>
		    <div id="blue_button"><div id="blue_button_word">&nbsp;权限修改</div></div>
		  	<div id="right_background">&nbsp;<br/> <br/> 
				<form action="./role/EditRoleAction" method="post" onsubmit="return sub()">
					<table cellpadding="10" cellspacing="10" border="0" >
					
						<tr align="right">
						<td width="300px"></td>
						
							<td>角色名称:</td>
							
							<td>
							<input type="hidden" name="role.RId" value="${role.RId}"/>
							<input type="text" id="name" name="role.RName" value="${role.RName}" onblur="check()"/>
							
							<font id="message" color="red"></font>
							</td>
							
							
						</tr>
						
						<tr align="right">
						<td width="300px"></td>
						
							<td>权限范围:</td>
							<td align="left">
								<SELECT name="role.RType" id="type" onchange="change()">
								
									<option value="1" <s:if test="role.RType==1">selected</s:if>  >机房管理</option>
									<option value="2" <s:if test="role.RType==2">selected</s:if> >部门管理</option>
									<option value="3" <s:if test="role.RType==3">selected</s:if> >人员管理</option>
									<option value="4" <s:if test="role.RType==4">selected</s:if> >日志管理</option>
									<option value="5" <s:if test="role.RType==5">selected</s:if> >权限管理</option>
							 
							
									
								
								</SELECT>
							</td>
							<td></td>
							<td></td>
						</tr>
						<tr align="right">
						<td width="300px"></td>
						
							<td>具体权限:</td>
							<td align="left"> 
								<SELECT name="role.RRw"  onfocus="change()">
									
									<option value="0" id="op1" >无任何权限</option>
									<option value="1"  id="del" <s:if test="role.RRw==1">selected</s:if> >只有查看权限</option>
									<option id="add" style="display:none;" value="2" <s:if test="role.RRw==2">selected</s:if> >可增删改查本部门员工</option>
									<option value="3" <s:if test="role.RRw==3">selected</s:if> >所有权限</option>
									
								
								</SELECT>
							</td>
							<td></td>
							<td></td>
						</tr>
						
					</table>
					<br/>
					<br/>
					
					<div align="center">
						<input type="submit" class="add" value="提交" /> &nbsp;&nbsp;
						<input type="reset" class="add" value="重置"/>
						<input type="button" class="add" value="返回" onclick="history.go(-1)"/>
					</div>
					
				</form>
		  	</div>
	  </body>
</html>

